#include <iostream>
#include <vector>
// #include <ranges>
using namespace std;
class Solution {
public:
    int findSmallestInteger(vector<int>& nums, int value) {
        vector<int> cnt(value, 0);
        for(int x:nums) 
            cnt[(x%value+value)%value]++;

        int mex=0;
        while(cnt[mex%value]-->0) mex++;
        
        return mex;
    }
};

signed main()
{
    Solution solution;
    vector<int> nums1={1,-10,7,13,6,8};
    int value1=5;
    cout << "solution1:" << solution.findSmallestInteger(nums1, value1) << endl;
    vector<int> nums2={1,-10,7,13,6,8};
    int value2=7;
    cout << "solution2:" << solution.findSmallestInteger(nums2, value2) << endl;

    return 0;
}